import copy

# 原始列表（包含嵌套列表）
original = [1, 2, [3, 4]]

# 1. 直接赋值（共享引用）

num1, num2, lst = original
# print(f"num1={num1},num2={num2},lst={lst}")
# print(f"original在内存中的地址={id(original)}")

assigned = original
assigned[0] = 99
print(original)  # [99, 2, [3, 4]] - 被修改了

# print(f"num1={num1},num1在内存中地址={id(num1)},assigned[0]的地址={id(assigned[0])}")

# 浅拷贝
import copy

original = [1, 2, 3, [4, 5]]
a, b, c, lst = original
print(f"拷贝之前lst={lst}")
shallow_new_list = copy.copy(original)
print(
    f"拷贝了original的，shallow_new_list={shallow_new_list},shallow_new_list is original={
        shallow_new_list is original
    }"
)

lst.append(6)

m, n, z, new_lst = shallow_new_list

print(
    f"lst====={lst}, lst_id={id(lst)},new_lst={id(new_lst)},lst is new_lst={lst is new_lst}"
)
